I need to copy a text string in the object text to an attribute. |
Re: Copy object text string to attribute? |
Re: Copy object text string to attribute? Not too good with Regular Expressions but this may get you going:
string RegExpString = "^(\\[Doc[0-9]+\\])([" charOf(1) "-" charOf(255)"]*)"
Regexp reReqPro = regexp2(RegExpString)
void DoTest(string InString)
{ print InString "...\t"
string ReqPart, TxtPart
if (reReqPro InString) //
then
{ ReqPart = InString[match 1]
TxtPart = InString[match 2]
print "[" ReqPart "]\t^" TxtPart "^\n"
}
else print "no match\n"
}
DoTest("[Doc12]Test")
DoTest("[Doc1333332]Test")
DoTest("[Doc]Test")
|